# -*- coding: utf-8 -*-
"""
@Time ： 2023/5/12 12:44
@Auth ： 刘佳
@File ：menuUtil.py
@IDE ：PyCharm
@Motto: 菜单相关
"""
from lucky import models

# 菜单查询
def queryMenu(sup):
    if sup :
        firstmenu = models.FirstMenu.objects.order_by('id')
    else:
        firstmenu = models.FirstMenu.objects.exclude(id='2').order_by('id')
    secondmenu = models.SecondMenu.objects.order_by('id')
    thirdmenu = models.ThirdMenu.objects.order_by('id')
    return firstmenu,secondmenu,thirdmenu

# 用户信息查询
def queryUser(username):
    user = models.UserInfo.objects.get(username=username)
    return user

# 字符串格式化
def htmlFormat(res):
    str1 = res.replace("\n", "<br>")
    str2 = str1.replace(" ", "&nbsp;")
    str = str2.replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;")
    return str

